<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>
      app/controllers/items_controller.rb - C0 code coverage information
    </title>
    <style type='text/css'>
      body { background-color: rgb(240, 240, 245); }
    </style>
    <style type='text/css'>
      span.cross-ref-title { font-size: 140%; } span.cross-ref a {
      text-decoration: none; } span.cross-ref { background-color:#f3f7fa;
      border: 1px dashed #333; margin: 1em; padding: 0.5em; overflow: hidden; }
      a.crossref-toggle { text-decoration: none; } span.marked0 {
      background-color: rgb(185, 210, 200); display: block; } span.marked1 {
      background-color: rgb(190, 215, 205); display: block; } span.inferred0 {
      background-color: rgb(175, 200, 200); display: block; } span.inferred1 {
      background-color: rgb(180, 205, 205); display: block; } span.uncovered0 {
      background-color: rgb(225, 110, 110); display: block; } span.uncovered1 {
      background-color: rgb(235, 120, 120); display: block; } span.overview {
      border-bottom: 8px solid black; } div.overview { border-bottom: 8px solid
      black; } body { font-family: verdana, arial, helvetica; } div.footer {
      font-size: 68%; margin-top: 1.5em; } h1, h2, h3, h4, h5, h6 {
      margin-bottom: 0.5em; } h5 { margin-top: 0.5em; } .hidden { display: none;
      } div.separator { height: 10px; } /* Commented out for better readability,
      esp. on IE */ /* table tr td, table tr th { font-size: 68%; } td.value
      table tr td { font-size: 11px; } */ table.percent_graph { height: 12px;
      border: #808080 1px solid; empty-cells: show; } table.percent_graph
      td.covered { height: 10px; background: #00f000; } table.percent_graph
      td.uncovered { height: 10px; background: #e00000; } table.percent_graph
      td.NA { height: 10px; background: #eaeaea; } table.report {
      border-collapse: collapse; width: 100%; } table.report td.heading {
      background: #dcecff; border: #d0d0d0 1px solid; font-weight: bold;
      text-align: center; } table.report td.heading:hover { background: #c0ffc0;
      } table.report td.text { border: #d0d0d0 1px solid; } table.report
      td.value, table.report td.lines_total, table.report td.lines_code {
      text-align: right; border: #d0d0d0 1px solid; } table.report tr.light {
      background-color: rgb(240, 240, 245); } table.report tr.dark {
      background-color: rgb(230, 230, 235); } 
    </style>
    <script type='text/javascript'>
       // <![CDATA[ function toggleCode( id ) { if ( document.getElementById )
      elem = document.getElementById( id ); else if ( document.all ) elem =
      eval( "document.all." + id ); else return false; elemStyle = elem.style;
      if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else {
      elemStyle.display = "none" } return true; } // Make cross-references
      hidden by default document.writeln( "<style
      type=\"text/css\">span.cross-ref { display: none }</style>" ) // ]]> 
    </script>
    <style type='text/css'>
      span.run0 { background-color: rgb(178, 204, 255); display: block; }
      span.run1 { background-color: rgb(178, 206, 255); display: block; }
      span.run2 { background-color: rgb(178, 209, 255); display: block; }
      span.run3 { background-color: rgb(178, 211, 255); display: block; }
      span.run4 { background-color: rgb(178, 214, 255); display: block; }
      span.run5 { background-color: rgb(178, 218, 255); display: block; }
      span.run6 { background-color: rgb(178, 220, 255); display: block; }
      span.run7 { background-color: rgb(178, 223, 255); display: block; }
      span.run8 { background-color: rgb(178, 225, 255); display: block; }
      span.run9 { background-color: rgb(178, 228, 255); display: block; }
      span.run10 { background-color: rgb(178, 232, 255); display: block; }
      span.run11 { background-color: rgb(178, 234, 255); display: block; }
      span.run12 { background-color: rgb(178, 237, 255); display: block; }
      span.run13 { background-color: rgb(178, 239, 255); display: block; }
      span.run14 { background-color: rgb(178, 242, 255); display: block; }
      span.run15 { background-color: rgb(178, 246, 255); display: block; }
      span.run16 { background-color: rgb(178, 248, 255); display: block; }
      span.run17 { background-color: rgb(178, 251, 255); display: block; }
      span.run18 { background-color: rgb(178, 253, 255); display: block; }
      span.run19 { background-color: rgb(178, 255, 253); display: block; }
      span.run20 { background-color: rgb(178, 255, 249); display: block; }
      span.run21 { background-color: rgb(178, 255, 247); display: block; }
      span.run22 { background-color: rgb(178, 255, 244); display: block; }
      span.run23 { background-color: rgb(178, 255, 242); display: block; }
      span.run24 { background-color: rgb(178, 255, 239); display: block; }
      span.run25 { background-color: rgb(178, 255, 235); display: block; }
      span.run26 { background-color: rgb(178, 255, 233); display: block; }
      span.run27 { background-color: rgb(178, 255, 230); display: block; }
      span.run28 { background-color: rgb(178, 255, 228); display: block; }
      span.run29 { background-color: rgb(178, 255, 225); display: block; }
      span.run30 { background-color: rgb(178, 255, 221); display: block; }
      span.run31 { background-color: rgb(178, 255, 219); display: block; }
      span.run32 { background-color: rgb(178, 255, 216); display: block; }
      span.run33 { background-color: rgb(178, 255, 214); display: block; }
      span.run34 { background-color: rgb(178, 255, 211); display: block; }
      span.run35 { background-color: rgb(178, 255, 207); display: block; }
      span.run36 { background-color: rgb(178, 255, 205); display: block; }
      span.run37 { background-color: rgb(178, 255, 202); display: block; }
      span.run38 { background-color: rgb(178, 255, 200); display: block; }
      span.run39 { background-color: rgb(178, 255, 197); display: block; }
      span.run40 { background-color: rgb(178, 255, 193); display: block; }
      span.run41 { background-color: rgb(178, 255, 191); display: block; }
      span.run42 { background-color: rgb(178, 255, 188); display: block; }
      span.run43 { background-color: rgb(178, 255, 186); display: block; }
      span.run44 { background-color: rgb(178, 255, 183); display: block; }
      span.run45 { background-color: rgb(178, 255, 179); display: block; }
      span.run46 { background-color: rgb(179, 255, 178); display: block; }
      span.run47 { background-color: rgb(182, 255, 178); display: block; }
      span.run48 { background-color: rgb(184, 255, 178); display: block; }
      span.run49 { background-color: rgb(187, 255, 178); display: block; }
      span.run50 { background-color: rgb(191, 255, 178); display: block; }
      span.run51 { background-color: rgb(193, 255, 178); display: block; }
      span.run52 { background-color: rgb(196, 255, 178); display: block; }
      span.run53 { background-color: rgb(198, 255, 178); display: block; }
      span.run54 { background-color: rgb(201, 255, 178); display: block; }
      span.run55 { background-color: rgb(205, 255, 178); display: block; }
      span.run56 { background-color: rgb(207, 255, 178); display: block; }
      span.run57 { background-color: rgb(210, 255, 178); display: block; }
      span.run58 { background-color: rgb(212, 255, 178); display: block; }
      span.run59 { background-color: rgb(215, 255, 178); display: block; }
      span.run60 { background-color: rgb(219, 255, 178); display: block; }
      span.run61 { background-color: rgb(221, 255, 178); display: block; }
      span.run62 { background-color: rgb(224, 255, 178); display: block; }
      span.run63 { background-color: rgb(226, 255, 178); display: block; }
      span.run64 { background-color: rgb(229, 255, 178); display: block; }
      span.run65 { background-color: rgb(233, 255, 178); display: block; }
      span.run66 { background-color: rgb(235, 255, 178); display: block; }
      span.run67 { background-color: rgb(238, 255, 178); display: block; }
      span.run68 { background-color: rgb(240, 255, 178); display: block; }
      span.run69 { background-color: rgb(243, 255, 178); display: block; }
      span.run70 { background-color: rgb(247, 255, 178); display: block; }
      span.run71 { background-color: rgb(249, 255, 178); display: block; }
      span.run72 { background-color: rgb(252, 255, 178); display: block; }
      span.run73 { background-color: rgb(255, 255, 178); display: block; }
      span.run74 { background-color: rgb(255, 252, 178); display: block; }
      span.run75 { background-color: rgb(255, 248, 178); display: block; }
      span.run76 { background-color: rgb(255, 246, 178); display: block; }
      span.run77 { background-color: rgb(255, 243, 178); display: block; }
      span.run78 { background-color: rgb(255, 240, 178); display: block; }
      span.run79 { background-color: rgb(255, 238, 178); display: block; }
      span.run80 { background-color: rgb(255, 234, 178); display: block; }
      span.run81 { background-color: rgb(255, 232, 178); display: block; }
      span.run82 { background-color: rgb(255, 229, 178); display: block; }
      span.run83 { background-color: rgb(255, 226, 178); display: block; }
      span.run84 { background-color: rgb(255, 224, 178); display: block; }
      span.run85 { background-color: rgb(255, 220, 178); display: block; }
      span.run86 { background-color: rgb(255, 218, 178); display: block; }
      span.run87 { background-color: rgb(255, 215, 178); display: block; }
      span.run88 { background-color: rgb(255, 212, 178); display: block; }
      span.run89 { background-color: rgb(255, 210, 178); display: block; }
      span.run90 { background-color: rgb(255, 206, 178); display: block; }
      span.run91 { background-color: rgb(255, 204, 178); display: block; }
      span.run92 { background-color: rgb(255, 201, 178); display: block; }
      span.run93 { background-color: rgb(255, 198, 178); display: block; }
      span.run94 { background-color: rgb(255, 196, 178); display: block; }
      span.run95 { background-color: rgb(255, 192, 178); display: block; }
      span.run96 { background-color: rgb(255, 189, 178); display: block; }
      span.run97 { background-color: rgb(255, 187, 178); display: block; }
      span.run98 { background-color: rgb(255, 184, 178); display: block; }
      span.run99 { background-color: rgb(255, 182, 178); display: block; }
      span.run100 { background-color: rgb(255, 178, 178); display: block; } 
    </style>
  </head>
  <body>
    <h3>
      C0 code coverage information
    </h3>
    <p>
      Generated on Fri May 27 02:08:48 +0000 2011 with 
      <a href='http://eigenclass.org/hiki/rcov'>
        rcov 0.8.1.2
      </a>
    </p>
    <hr />
    <pre><span class='marked0'>Code reported as executed by Ruby looks like
    this... </span><span class='marked1'>and this: this line is also marked as
    covered. </span><span class='inferred0'>Lines considered as run by rcov, but
    not reported by Ruby, look like this, </span><span class='inferred1'>and
    this: these lines were inferred by rcov (using simple heuristics).
    </span><span class='uncovered0'>Finally, here&apos;s a line marked as not
    executed. </span></pre> 
    <table class='report'> <thead> <tr> <td class='heading'> Name </td> <td
    class='heading'> Total lines </td> <td class='heading'> Lines of code </td>
    <td class='heading'> Total coverage </td> <td class='heading'> Code coverage
    </td> </tr> </thead> <tbody> <tr class='light'> <td> <a
    href='app-controllers-items_controller_rb.html'>
    app/controllers/items_controller.rb </a> </td> <td class='lines_total'> <tt>
    291 </tt> </td> <td class='lines_code'> <tt> 237 </tt> </td> <td> <table
    cellspacing='0' align='right' cellpadding='0'> <tr> <td> <tt
    class='coverage_total'> 55.7% </tt> &nbsp; </td> <td> <table
    class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
    class='covered' width='56' /> <td class='uncovered' width='44' /> </tr>
    </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
    align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 47.7%
    </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
    width='100' cellpadding='0'> <tr> <td class='covered' width='48' /> <td
    class='uncovered' width='52' /> </tr> </table> </td> </tr> </table> </td>
    </tr> </tbody> </table><pre><span class="marked1"><a name="line1"></a> 1
    require 'will_paginate' </span><span class="inferred0"><a name="line2"></a>
    2 </span><span class="marked1"><a name="line3"></a> 3 class ItemsController
    &lt; ApplicationController </span><span class="marked0"><a name="line4"></a>
    4 before_filter :except =&gt; [:item_attributes, :comments, :cap_color,
    :by_barcode, :bag_contents_by_barcode, :bag_contents] do |controller|
    </span><span class="marked1"><a name="line5"></a> 5
    controller.authorize_permissions({:blocked_permissions =&gt;
    [&quot;courier&quot;]}) </span><span class="inferred0"><a name="line6"></a>
    6 end </span><span class="inferred1"><a name="line7"></a> 7 </span><span
    class="marked0"><a name="line8"></a> 8 def comments </span><span
    class="uncovered1"><a name="line9"></a> 9 @comments =
    Item.find_by_id(params[&quot;id&quot;]).comments </span><span
    class="uncovered0"><a name="line10"></a> 10 respond_to do |format|
    </span><span class="uncovered1"><a name="line11"></a> 11 format.json {
    render :json =&gt; @comments } </span><span class="uncovered0"><a
    name="line12"></a> 12 end </span><span class="uncovered1"><a
    name="line13"></a> 13 end </span><span class="inferred0"><a
    name="line14"></a> 14 </span><span class="marked1"><a name="line15"></a> 15
    def item_attributes </span><span class="uncovered0"><a name="line16"></a> 16
    @attributes = Item.find_by_id(params[&quot;id&quot;]).item_attributes
    </span><span class="uncovered1"><a name="line17"></a> 17 respond_to do
    |format| </span><span class="uncovered0"><a name="line18"></a> 18
    format.json { render :json =&gt; @attributes } </span><span
    class="uncovered1"><a name="line19"></a> 19 end </span><span
    class="uncovered0"><a name="line20"></a> 20 end </span><span
    class="inferred1"><a name="line21"></a> 21 </span><span class="marked0"><a
    name="line22"></a> 22 def cap_color </span><span class="inferred1"><a
    name="line23"></a> 23 @item = Item.find_by_id(params[&quot;id&quot;])
    </span><span class="uncovered0"><a name="line24"></a> 24 @color_id =
    ItemAttributeSet.find_by_name(&quot;Color&quot;).id </span><span
    class="uncovered1"><a name="line25"></a> 25 @color =
    @item.item_attributes.find_by_item_attribute_set_id(@color_id) </span><span
    class="uncovered0"><a name="line26"></a> 26 respond_to do |format|
    </span><span class="uncovered1"><a name="line27"></a> 27 format.json {
    render :json =&gt; [@color] } </span><span class="uncovered0"><a
    name="line28"></a> 28 end </span><span class="uncovered1"><a
    name="line29"></a> 29 end </span><span class="inferred0"><a
    name="line30"></a> 30 </span><span class="marked1"><a name="line31"></a> 31
    def by_barcode </span><span class="uncovered0"><a name="line32"></a> 32
    @item = Identifier.find_by_identifier_value(params[&quot;id&quot;]).item
    </span><span class="uncovered1"><a name="line33"></a> 33 respond_to do
    |format| </span><span class="uncovered0"><a name="line34"></a> 34
    format.json { render :json =&gt; [@item] } </span><span
    class="uncovered1"><a name="line35"></a> 35 end </span><span
    class="uncovered0"><a name="line36"></a> 36 end </span><span
    class="inferred1"><a name="line37"></a> 37 </span><span class="marked0"><a
    name="line38"></a> 38 def bag_contents_by_barcode </span><span
    class="uncovered1"><a name="line39"></a> 39 @bag =
    Identifier.find_by_identifier_value(params[&quot;id&quot;]).item
    </span><span class="uncovered0"><a name="line40"></a> 40 respond_to do
    |format| </span><span class="uncovered1"><a name="line41"></a> 41
    format.json { render :json =&gt; @bag.contained_items } </span><span
    class="uncovered0"><a name="line42"></a> 42 end </span><span
    class="uncovered1"><a name="line43"></a> 43 end </span><span
    class="inferred0"><a name="line44"></a> 44 </span><span class="marked1"><a
    name="line45"></a> 45 def bag_contents </span><span class="uncovered0"><a
    name="line46"></a> 46 @bag = Item.find_by_id(params[&quot;id&quot;])
    </span><span class="uncovered1"><a name="line47"></a> 47 respond_to do
    |format| </span><span class="uncovered0"><a name="line48"></a> 48
    format.json { render :json =&gt; @bag.contained_items } </span><span
    class="uncovered1"><a name="line49"></a> 49 end </span><span
    class="uncovered0"><a name="line50"></a> 50 end </span><span
    class="inferred1"><a name="line51"></a> 51 </span><span class="marked0"><a
    name="line52"></a> 52 helper_method :populate_new_item </span><span
    class="marked1"><a name="line53"></a> 53 def populate_new_item </span><span
    class="marked0"><a name="line54"></a> 54 @item = Item.new </span><span
    class="marked1"><a name="line55"></a> 55 @item.comments &lt;&lt; Comment.new
    </span><span class="marked0"><a name="line56"></a> 56 @item.identifiers
    &lt;&lt; Identifier.new </span><span class="inferred1"><a name="line57"></a>
    57 </span><span class="inferred0"><a name="line58"></a> 58 # add set
    attributes that need to so can use fields_for </span><span
    class="marked1"><a name="line59"></a> 59 @attribute_sets =
    ItemAttributeSet.all </span><span class="marked0"><a name="line60"></a> 60
    @attribute_sets.each do |attribute_set| </span><span class="marked1"><a
    name="line61"></a> 61 if attribute_set.item_attributes.first </span><span
    class="marked0"><a name="line62"></a> 62 if attribute_set.mutually_exclusive
    </span><span class="marked1"><a name="line63"></a> 63
    @item.item_attribute_values &lt;&lt; ItemAttributeValue.new </span><span
    class="uncovered0"><a name="line64"></a> 64 else </span><span
    class="uncovered1"><a name="line65"></a> 65
    attribute_set.item_attributes.each do |attr| </span><span
    class="uncovered0"><a name="line66"></a> 66 @item.item_attribute_values
    &lt;&lt; ItemAttributeValue.new </span><span class="uncovered1"><a
    name="line67"></a> 67 end </span><span class="uncovered0"><a
    name="line68"></a> 68 end </span><span class="uncovered1"><a
    name="line69"></a> 69 else </span><span class="uncovered0"><a
    name="line70"></a> 70 @item.item_attribute_values &lt;&lt;
    ItemAttributeValue.new </span><span class="uncovered1"><a name="line71"></a>
    71 end </span><span class="uncovered0"><a name="line72"></a> 72 end
    </span><span class="inferred1"><a name="line73"></a> 73 </span><span
    class="marked0"><a name="line74"></a> 74 @other_attributes =
    ItemAttribute.find_all_by_item_attribute_set_id(nil) </span><span
    class="marked1"><a name="line75"></a> 75 @other_attributes.each do
    |attribute| </span><span class="marked0"><a name="line76"></a> 76
    @item.item_attribute_values &lt;&lt; ItemAttributeValue.new </span><span
    class="inferred1"><a name="line77"></a> 77 end </span><span
    class="inferred0"><a name="line78"></a> 78 </span><span class="marked1"><a
    name="line79"></a> 79 @item </span><span class="inferred0"><a
    name="line80"></a> 80 end </span><span class="inferred1"><a
    name="line81"></a> 81 </span><span class="marked0"><a name="line82"></a> 82
    def filter(title, items, params) </span><span class="marked1"><a
    name="line83"></a> 83 @filter_by = &quot;&quot; </span><span
    class="marked0"><a name="line84"></a> 84 if params[:item_types] &amp;&amp;
    params[:item_types][:id] &amp;&amp; params[:item_types][:id] != &quot;&quot;
    </span><span class="uncovered1"><a name="line85"></a> 85 @items_t =
    Item.find_all_by_item_type_id(params[:item_types][:id]) </span><span
    class="uncovered0"><a name="line86"></a> 86 @item_type =
    ItemType.find(params[:item_types][:id]) </span><span class="uncovered1"><a
    name="line87"></a> 87 @filter_by += &quot; '&quot; + @item_type.item_type +
    &quot;'&quot; </span><span class="uncovered0"><a name="line88"></a> 88
    flag_t = true </span><span class="uncovered1"><a name="line89"></a> 89
    @item_types = ItemType.find_by_id(params[:item_types][:id]) </span><span
    class="inferred0"><a name="line90"></a> 90 else </span><span
    class="marked1"><a name="line91"></a> 91 flag_t = false </span><span
    class="inferred0"><a name="line92"></a> 92 end </span><span
    class="inferred1"><a name="line93"></a> 93 </span><span class="marked0"><a
    name="line94"></a> 94 if params[:status] &amp;&amp; params[:status] !=
    &quot;&quot; </span><span class="uncovered1"><a name="line95"></a> 95
    @items_s = Array.new </span><span class="uncovered0"><a name="line96"></a>
    96 Item.all.each do |item| </span><span class="uncovered1"><a
    name="line97"></a> 97 @checkins = CheckIn.find_all_by_item_id(item.id,
    :order =&gt; &quot;created_at DESC&quot;) </span><span class="uncovered0"><a
    name="line98"></a> 98 if @checkins.first &amp;&amp; @checkins.first.action
    == params[:status] </span><span class="uncovered1"><a name="line99"></a> 99
    @items_s &lt;&lt; item </span><span class="uncovered0"><a
    name="line100"></a>100 end </span><span class="uncovered1"><a
    name="line101"></a>101 end </span><span class="uncovered0"><a
    name="line102"></a>102 if params[:status] == 'initial_checkin' </span><span
    class="uncovered1"><a name="line103"></a>103 @status = &quot;Waiting
    Pickup&quot; </span><span class="uncovered0"><a name="line104"></a>104 elsif
    params[:status] == 'pick_up' </span><span class="uncovered1"><a
    name="line105"></a>105 @status = &quot;In transit&quot; </span><span
    class="uncovered0"><a name="line106"></a>106 elsif params[:status] ==
    'drop_off' </span><span class="uncovered1"><a name="line107"></a>107 @status
    = &quot;Delivered&quot; </span><span class="uncovered0"><a
    name="line108"></a>108 else </span><span class="uncovered1"><a
    name="line109"></a>109 @status = &quot;Unknown&quot; </span><span
    class="uncovered0"><a name="line110"></a>110 end </span><span
    class="uncovered1"><a name="line111"></a>111 @filter_by += &quot; '&quot; +
    @status + &quot;'&quot; </span><span class="uncovered0"><a
    name="line112"></a>112 flag_s = true </span><span class="uncovered1"><a
    name="line113"></a>113 @status = params[:status] </span><span
    class="inferred0"><a name="line114"></a>114 else </span><span
    class="marked1"><a name="line115"></a>115 flag_s = false </span><span
    class="inferred0"><a name="line116"></a>116 end </span><span
    class="inferred1"><a name="line117"></a>117 </span><span class="marked0"><a
    name="line118"></a>118 if params[:item_attributes] &amp;&amp;
    params[:item_attributes][:id] &amp;&amp; params[:item_attributes][:id] !=
    &quot;&quot; </span><span class="uncovered1"><a name="line119"></a>119
    @items_a = Array.new </span><span class="uncovered0"><a
    name="line120"></a>120 @attribute =
    ItemAttribute.find(params[:item_attributes][:id]) </span><span
    class="uncovered1"><a name="line121"></a>121 @attribute_values =
    @attribute.item_attribute_values </span><span class="uncovered0"><a
    name="line122"></a>122 @attribute_values.each do |attribute_value|
    </span><span class="uncovered1"><a name="line123"></a>123 @items_a &lt;&lt;
    attribute_value.item </span><span class="uncovered0"><a
    name="line124"></a>124 end </span><span class="uncovered1"><a
    name="line125"></a>125 @filter_by += &quot; '&quot; +
    @attribute.display_text + &quot;'&quot; </span><span class="uncovered0"><a
    name="line126"></a>126 flag_a = true </span><span class="uncovered1"><a
    name="line127"></a>127 @item_attributes =
    ItemAttribute.find_by_id(params[:item_attributes][:id]) </span><span
    class="inferred0"><a name="line128"></a>128 else </span><span
    class="marked1"><a name="line129"></a>129 flag_a = false </span><span
    class="inferred0"><a name="line130"></a>130 end </span><span
    class="inferred1"><a name="line131"></a>131 </span><span class="marked0"><a
    name="line132"></a>132 items = items.find_all{|item| </span><span
    class="marked1"><a name="line133"></a>133 ((!flag_t) ||
    @items_t.include?(item)) &amp;&amp; </span><span class="marked0"><a
    name="line134"></a>134 ((!flag_s) || @items_s.include?(item)) &amp;&amp;
    </span><span class="marked1"><a name="line135"></a>135 ((!flag_a) ||
    @items_a.include?(item)) </span><span class="inferred0"><a
    name="line136"></a>136 } </span><span class="inferred1"><a
    name="line137"></a>137 </span><span class="marked0"><a
    name="line138"></a>138 if @filter_by != &quot;&quot; </span><span
    class="uncovered1"><a name="line139"></a>139 title += &quot;:&quot; +
    @filter_by </span><span class="uncovered0"><a name="line140"></a>140 end
    </span><span class="marked1"><a name="line141"></a>141 return title, items
    </span><span class="inferred0"><a name="line142"></a>142 end </span><span
    class="inferred1"><a name="line143"></a>143 </span><span
    class="inferred0"><a name="line144"></a>144 # GET /items </span><span
    class="inferred1"><a name="line145"></a>145 # GET /items.json </span><span
    class="marked0"><a name="line146"></a>146 def index </span><span
    class="inferred1"><a name="line147"></a>147 </span><span class="marked0"><a
    name="line148"></a>148 @title, @items = filter(&quot;All Items&quot;,
    Item.find(:all, :order =&gt; &quot;created_at DESC&quot;), params)
    </span><span class="inferred1"><a name="line149"></a>149 </span><span
    class="marked0"><a name="line150"></a>150 @page_results =
    @items.paginate(:page =&gt; params[:page], :per_page =&gt; 10) </span><span
    class="inferred1"><a name="line151"></a>151 </span><span class="marked0"><a
    name="line152"></a>152 respond_to do |format| </span><span
    class="marked1"><a name="line153"></a>153 format.html # index.html.erb
    </span><span class="marked0"><a name="line154"></a>154 format.json { render
    :json =&gt; @items } </span><span class="inferred1"><a
    name="line155"></a>155 end </span><span class="inferred0"><a
    name="line156"></a>156 end </span><span class="inferred1"><a
    name="line157"></a>157 </span><span class="marked0"><a
    name="line158"></a>158 def barcode </span><span class="uncovered1"><a
    name="line159"></a>159 @item = Item.find(params[:id]) </span><span
    class="uncovered0"><a name="line160"></a>160 @barcode =
    @item.identifiers.first </span><span class="uncovered1"><a
    name="line161"></a>161 @children =
    Item.find_all_by_contained_by_id(@item.id) </span><span
    class="uncovered0"><a name="line162"></a>162 @children_barcodes = Array.new
    </span><span class="uncovered1"><a name="line163"></a>163 @children.each do
    |child| </span><span class="uncovered0"><a name="line164"></a>164
    @children_barcodes &lt;&lt; child.identifiers.first.identifier_value
    </span><span class="uncovered1"><a name="line165"></a>165 end </span><span
    class="uncovered0"><a name="line166"></a>166 @title = &quot;Barcode: &quot;
    + @barcode.identifier_value </span><span class="uncovered1"><a
    name="line167"></a>167 </span><span class="uncovered0"><a
    name="line168"></a>168 respond_to do |format| </span><span
    class="uncovered1"><a name="line169"></a>169 format.html </span><span
    class="uncovered0"><a name="line170"></a>170 format.json { render :json
    =&gt; [@barcode]} </span><span class="uncovered1"><a name="line171"></a>171
    end </span><span class="uncovered0"><a name="line172"></a>172 end
    </span><span class="inferred1"><a name="line173"></a>173 </span><span
    class="marked0"><a name="line174"></a>174 def incoming </span><span
    class="marked1"><a name="line175"></a>175 @user =
    User.find_by_id(session[:user_id]) </span><span class="marked0"><a
    name="line176"></a>176 @title, @items = filter(&quot;Incoming Items&quot;,
    Item.find_all_by_destination_id_and_delivered(@user.location.id, false,
    :order =&gt; &quot;created_at DESC&quot;), params) </span><span
    class="inferred1"><a name="line177"></a>177 </span><span class="marked0"><a
    name="line178"></a>178 @page_results = @items.paginate(:page =&gt;
    params[:page], :per_page =&gt; 10) </span><span class="inferred1"><a
    name="line179"></a>179 end </span><span class="inferred0"><a
    name="line180"></a>180 </span><span class="marked1"><a
    name="line181"></a>181 def outgoing </span><span class="marked0"><a
    name="line182"></a>182 @user = User.find_by_id(session[:user_id])
    </span><span class="marked1"><a name="line183"></a>183 @title, @items =
    filter(&quot;Outgoing Items&quot;,
    Item.find_all_by_source_id_and_delivered(@user.location.id, false, :order
    =&gt; &quot;created_at DESC&quot;), params) </span><span
    class="inferred0"><a name="line184"></a>184 </span><span class="marked1"><a
    name="line185"></a>185 @page_results = @items.paginate(:page =&gt;
    params[:page], :per_page =&gt; 10) </span><span class="inferred0"><a
    name="line186"></a>186 end </span><span class="inferred1"><a
    name="line187"></a>187 </span><span class="marked0"><a
    name="line188"></a>188 def lookup </span><span class="uncovered1"><a
    name="line189"></a>189 if params[:q] </span><span class="uncovered0"><a
    name="line190"></a>190 @identifier =
    Identifier.find_by_identifier_value(params[:q]) </span><span
    class="uncovered1"><a name="line191"></a>191 if @identifier.nil?
    </span><span class="uncovered0"><a name="line192"></a>192 flash_msg =
    &quot;Identifier \&quot;#{params[:q]}\&quot; not found&quot; </span><span
    class="uncovered1"><a name="line193"></a>193 if params[:from] == 'check_ins'
    </span><span class="uncovered0"><a name="line194"></a>194 flash[:notice] =
    flash_msg </span><span class="uncovered1"><a name="line195"></a>195
    redirect_to check_ins_path </span><span class="uncovered0"><a
    name="line196"></a>196 else </span><span class="uncovered1"><a
    name="line197"></a>197 flash.now[:notice] = flash_msg </span><span
    class="uncovered0"><a name="line198"></a>198 @title = &quot;Lookup
    Items&quot; </span><span class="uncovered1"><a name="line199"></a>199 render
    'lookup' </span><span class="uncovered0"><a name="line200"></a>200 end
    </span><span class="uncovered1"><a name="line201"></a>201 elsif </span><span
    class="uncovered0"><a name="line202"></a>202 @item = @identifier.item
    </span><span class="uncovered1"><a name="line203"></a>203 @type =
    @item.item_type </span><span class="uncovered0"><a name="line204"></a>204
    @item_type = (@type)?(@type.item_type):(&quot;No Type&quot;) </span><span
    class="uncovered1"><a name="line205"></a>205 @displayed_id =
    (@identifier)?(@identifier.identifier_value):(&quot;No ID&quot;)
    </span><span class="uncovered0"><a name="line206"></a>206 </span><span
    class="uncovered1"><a name="line207"></a>207 @title = &quot;Item &quot; +
    @displayed_id </span><span class="uncovered0"><a name="line208"></a>208
    </span><span class="uncovered1"><a name="line209"></a>209 if params[:from]
    == 'check_ins' </span><span class="uncovered0"><a name="line210"></a>210
    redirect_to :controller =&gt; check_ins_path, :action =&gt; :item, :item_id
    =&gt; @item.id </span><span class="uncovered1"><a name="line211"></a>211
    else </span><span class="uncovered0"><a name="line212"></a>212 @from =
    :items </span><span class="uncovered1"><a name="line213"></a>213 render
    'lookup-item' </span><span class="uncovered0"><a name="line214"></a>214 end
    </span><span class="uncovered1"><a name="line215"></a>215 end </span><span
    class="uncovered0"><a name="line216"></a>216 else </span><span
    class="uncovered1"><a name="line217"></a>217 # Render regular scanning page
    otherwise </span><span class="uncovered0"><a name="line218"></a>218 if
    params[:from] == 'check_ins' </span><span class="uncovered1"><a
    name="line219"></a>219 redirect_to check_ins_path </span><span
    class="uncovered0"><a name="line220"></a>220 else </span><span
    class="uncovered1"><a name="line221"></a>221 @title = &quot;Lookup
    Items&quot; </span><span class="uncovered0"><a name="line222"></a>222 render
    'lookup' </span><span class="uncovered1"><a name="line223"></a>223 end
    </span><span class="uncovered0"><a name="line224"></a>224 end </span><span
    class="uncovered1"><a name="line225"></a>225 end </span><span
    class="inferred0"><a name="line226"></a>226 </span><span
    class="inferred1"><a name="line227"></a>227 # GET /items/1 </span><span
    class="inferred0"><a name="line228"></a>228 # GET /items/1.json </span><span
    class="marked1"><a name="line229"></a>229 def show </span><span
    class="marked0"><a name="line230"></a>230 @item = Item.find(params[:id])
    </span><span class="inferred1"><a name="line231"></a>231 </span><span
    class="marked0"><a name="line232"></a>232 @type = @item.item_type
    </span><span class="marked1"><a name="line233"></a>233 @item_type =
    (@type)?(@type.item_type):(&quot;No Type&quot;) </span><span
    class="inferred0"><a name="line234"></a>234 </span><span class="marked1"><a
    name="line235"></a>235 @identifier = @item.identifiers.first </span><span
    class="marked0"><a name="line236"></a>236 @displayed_id =
    (@identifier)?(@identifier.identifier_value):(&quot;No ID&quot;)
    </span><span class="inferred1"><a name="line237"></a>237 </span><span
    class="marked0"><a name="line238"></a>238 @title = &quot;Item &quot; +
    @displayed_id </span><span class="inferred1"><a name="line239"></a>239
    </span><span class="marked0"><a name="line240"></a>240 respond_to do
    |format| </span><span class="marked1"><a name="line241"></a>241 format.html
    # show.html.erb </span><span class="marked0"><a name="line242"></a>242
    format.json { render :json =&gt; [@item] } </span><span class="inferred1"><a
    name="line243"></a>243 end </span><span class="inferred0"><a
    name="line244"></a>244 end </span><span class="inferred1"><a
    name="line245"></a>245 </span><span class="inferred0"><a
    name="line246"></a>246 # GET /items/new </span><span class="inferred1"><a
    name="line247"></a>247 # GET /items/new.json </span><span class="marked0"><a
    name="line248"></a>248 def new </span><span class="marked1"><a
    name="line249"></a>249 @title = &quot;New Item&quot; </span><span
    class="marked0"><a name="line250"></a>250 @item = populate_new_item
    </span><span class="inferred1"><a name="line251"></a>251 </span><span
    class="marked0"><a name="line252"></a>252 respond_to do |format|
    </span><span class="marked1"><a name="line253"></a>253 format.html #
    new.html.erb </span><span class="marked0"><a name="line254"></a>254
    format.json { render :json =&gt; @item } </span><span class="inferred1"><a
    name="line255"></a>255 end </span><span class="inferred0"><a
    name="line256"></a>256 end </span><span class="inferred1"><a
    name="line257"></a>257 </span><span class="inferred0"><a
    name="line258"></a>258 # POST /items </span><span class="inferred1"><a
    name="line259"></a>259 # POST /items.json </span><span class="marked0"><a
    name="line260"></a>260 def create </span><span class="marked1"><a
    name="line261"></a>261 @item = Item.new(params[:item]) </span><span
    class="inferred0"><a name="line262"></a>262 </span><span class="marked1"><a
    name="line263"></a>263 respond_to do |format| </span><span
    class="marked0"><a name="line264"></a>264 if @item.save </span><span
    class="marked1"><a name="line265"></a>265 flash[:notice] = 'Item was
    successfully created.' </span><span class="marked0"><a
    name="line266"></a>266 format.html { redirect_to items_path } </span><span
    class="marked1"><a name="line267"></a>267 format.json { render :json =&gt;
    @item, :status =&gt; :created, :location =&gt; @item } </span><span
    class="inferred0"><a name="line268"></a>268 else </span><span
    class="marked1"><a name="line269"></a>269 if @item.comments.empty?
    </span><span class="uncovered0"><a name="line270"></a>270 # Adds comment
    back if was deleted in validation </span><span class="uncovered1"><a
    name="line271"></a>271 @item.comments &lt;&lt; Comment.new </span><span
    class="uncovered0"><a name="line272"></a>272 end </span><span
    class="inferred1"><a name="line273"></a>273 </span><span class="marked0"><a
    name="line274"></a>274 format.html { render :action =&gt; &quot;new&quot; }
    </span><span class="marked1"><a name="line275"></a>275 format.json { render
    :json =&gt; @item.errors, :status =&gt; :unprocessable_entity } </span><span
    class="inferred0"><a name="line276"></a>276 end </span><span
    class="inferred1"><a name="line277"></a>277 end </span><span
    class="inferred0"><a name="line278"></a>278 end </span><span
    class="inferred1"><a name="line279"></a>279 </span><span
    class="inferred0"><a name="line280"></a>280 # DELETE /items/1 </span><span
    class="inferred1"><a name="line281"></a>281 # DELETE /items/1.json
    </span><span class="marked0"><a name="line282"></a>282 def destroy
    </span><span class="marked1"><a name="line283"></a>283 @item =
    Item.find(params[:id]) </span><span class="marked0"><a
    name="line284"></a>284 @item.destroy </span><span class="inferred1"><a
    name="line285"></a>285 </span><span class="marked0"><a
    name="line286"></a>286 respond_to do |format| </span><span
    class="marked1"><a name="line287"></a>287 format.html {
    redirect_to(items_url) } </span><span class="marked0"><a
    name="line288"></a>288 format.json { head :ok } </span><span
    class="inferred1"><a name="line289"></a>289 end </span><span
    class="inferred0"><a name="line290"></a>290 end </span><span
    class="inferred1"><a name="line291"></a>291 end </span></pre>
    <hr />
    <p> Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'> rcov
    code coverage analysis tool for Ruby </a> version 0.8.1.2. </p>
    <p>
      <a href='http://validator.w3.org/check/referer'>
        <img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88' />
      </a>
      <a href='http://jigsaw.w3.org/css-validator/check/referer'>
        <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
      </a>
    </p>
  </body>
</html>
